package org.example.controller;

import org.example.model.JSONResult;
import org.example.model.User;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: huang
 * @Date: 2021/8/26 11:13
 * @Description:
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @PostMapping("login")
    public  Object login(@RequestBody User user) {
        JSONResult json = new JSONResult();
        if(!"abc".equals(user.getUsername())) {
            json.setMsg("用户不存在");
            return json;
        }
        if (!"123".equals(user.getPassword())) {
            json.setMsg("用户名或密码错误");
            return json;
        }
        json.setOk(true);
        json.setData("登陆成功");
        return null;
    }
}
